home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk15 / sct / sct.doc < prev    next >
Text File  |  1995-03-18  |  9KB  |  194 lines

  1. SetColorTable (or SCT for short) is a CLI-based utility for displaying and/or
  2. setting a screen's colors.  It will allow you to change any or all of the
  3. colors for any screen whose "Screen Title" you know.  You can save the colors
  4. of a screen to be restored later, or easily copy one screen's colors to another.
  5. It works by creating an array of ColorTable entries and calling LoadRGB4.
  6.  
  7. SetColorTable is Copyright 1988 by aklevin.  All rights reserved.
  8. I copyrighted this because of all the talk of copyrighting, copy"wronging",
  9. and such on USENET.  SCT may not be sold without my express written permission.
  10. SCT may, however, be copied and distributed in a not-for-profit manner.
  11.  
  12. First an explanation of color values as they pertain to SCT:
  13.  
  14. Color values are specified as a four digit hexadecimal number (Xrgb) using
  15. the following convention:
  16.  
  17. Each of r, g, and b (red, green, and blue) is a hexadecimal digit ranging
  18. from 0 (none of that color) to f (the full amount of that color).
  19. So, as examples, black=000, medium red=800, yellow=ff0,  white=fff.
  20. The first digit (X) is an indicator flag.  If this digit is 0 (or is omitted),
  21. the rest of the number will be used as a color value to alter an entry in the
  22. ColorTable.  If this digit is a 1, it indicates that this value is to be
  23. skipped, it is only a placeholder to keep remaining values in sync.
  24. If this digit is a 2, it indicates that this value is to be skipped,
  25. and that there are no more values to be changed.  It is used when a less-
  26. then-complete set of color values is being entered from stdin.
  27.  
  28. As an example, the Workbench screen has four colors,
  29. and so has four entries in it's ColorTable:
  30.  
  31.   +- Background color (blue)
  32.   |    +- Text color (white)
  33.   |    |    +- Highlight color (near-black)
  34.   |    |    |    +- Cursor color (orange)
  35.   |    |    |    |
  36.   V    V    V    V
  37.  RGB  RGB  RGB  RGB
  38.  05a  fff  002  f80   <- These are the RGB values for each ColorTable entry.
  39.  
  40. The default Workbench colors would be given to SCT with:
  41. "SCT 005a 0fff 0002 0f80".
  42.  
  43. Other screens may have more colors than this.  You can find out by typing:
  44. "SCT 2000" which will display the RGB value for each entry the table has.
  45. The `2' in `2000', as explained above, makes that value a flag which tells
  46. SCT that there are no more RGB values to be read in.  Since it is the only
  47. value given, SCT won't change *any* entries.
  48.  
  49. There are two ways that SCT can get it's RGB values: from the command line,
  50. and from stdin (standard input).  You should use command line input when you
  51. know explicitly how you want to change the ColorTable.  You should use stdin
  52. when the ColorTable values are in a file, and you want SCT to get them from
  53. there.  Each way will be discussed separately.
  54.  
  55. Input from the Command Line:
  56.  
  57. SCT Xrgb Xrgb Xrgb...
  58. This instructs SCT to change the first N entries in the Workbench Screen's
  59. ColorTable (where N = the number of RGB values typed).  The Workbench Screen
  60. has four colors; if you type fewer than four, only that many entries will
  61. get modified.  If you type more than four, the extra ones are ignored.
  62. Remember that the X in each of those rgb values stands for an indicator flag.
  63. So, a value of 0f8f (or f8f) means "use this value to change the corresponding
  64. ColorTable entry to pink".  A value of 1f8f (or 1000, or any four-digit number
  65. beginning with a `1') means "ignore this value, but keep going".  You'd use
  66. this if you wanted to change one entry without disturbing previous ones.
  67.  
  68. For example, suppose that your Workbench Screen's colors are currently
  69. 357 fff 000 0bd, and you want to change the highlight color (third entry)
  70. from black (000) to white (fff).  You could type "SCT 0357 0fff 0fff 00bd"
  71. and that would work.  But now suppose that you didn't know what any of the
  72. four values were to begin with (you could use "SCT 2000" to find out, but
  73. bear with me).  Then you can use "SCT 1000 1000 0fff 1000" and only the third
  74. entry will be changed.  In fact, you can leave out the last `1000' since with
  75. command line input, SCT only changes as many entries as it has values.
  76.  
  77. SCT >colorfile Xrgb Xrgb Xrgb...
  78. As above, but rather than printing the Workbench Screen's colors, SCT puts
  79. them in the file called `colorfile'.  Later, using the stdin form of SCT,
  80. they can be read back in.  If you don't want the current values printed out,
  81. and also don't want them sent to a file, use "SCT >NIL: Xrgb Xrgb Xrgb... ".
  82.  
  83. SCT -t "Screen Title" Xrgb Xrgb Xrgb...
  84. Like "SCT Xrgb Xrgb Xrgb... " above, but instead of operating on the
  85. Workbench Screen, SCT searches for a screen whose title is "Screen Title"
  86. and displays and/or changes the ColorTable for it.  Note that you must know
  87. the exact title of the screen to specify it to SCT.  Some screens don't show
  88. their title, some screens don't even have a title.  I have included another
  89. little utility I wrote called `Cruise', which will show you the titles of all
  90. open screens and their windows.  From that you can probably tell whether or
  91. not your screen has a title.  If it doesn't, you can either give up, or modify
  92. SCT.c to default to the ActiveScreen (sic), rather than the Workbench Screen.
  93. I recommend the latter approach, and I'd like to see your work if you
  94. do it.  Also note that screens other than the Workbench Screen
  95. can have 2, 4, 8, 16 or 32 ColorTable entries.
  96.  
  97. SCT >colorfile -t "Screen Title" Xrgb Xrgb Xrgb...
  98. As above, but rather than printing the "Screen Title" screen's colors, SCT
  99. puts them in the file called `colorfile'.  Later, using the stdin form of SCT,
  100. they can be read back in.  If you don't want the current values printed out,
  101. and also don't want them sent to a file, use "SCT >NIL: Xrgb Xrgb Xrgb... .
  102.  
  103. Input from Stdin:
  104.  
  105. SCT <colorfile
  106. Like "SCT Xrgb Xrgb Xrgb..." above, but instead of receiving the RGB values
  107. from the command line, SCT gets them from the file `colorfile'.
  108. Values can be one to a line or separated by spaces.
  109.  
  110. SCT <colorfile -t "Screen Title"
  111. Like "SCT -t "Screen Title" Xrgb Xrgb Xrgb..." above, but instead of receiving
  112. the RGB values from the command line, SCT gets them from the file `colorfile'.
  113.  
  114. Please note that when you use " >file", " <file" or " >NIL:" (this is known
  115. as input and output redirection) it must come before any Xrgb values, as well
  116. as a screen title option, so "SCT 2000 -t "A Title" >NIL:" won't work.
  117.  
  118. Now for some useful examples:
  119.  
  120. There are some programs out there that don't look too good with the Workbench
  121. colors I choose to use.  As a matter of fact, there are some programs that
  122. don't look too good even with the default Workbench colors.
  123. There are also some programs for which I always find myself calling up
  124. `Preferences' to change the colors so that the text that looked good with the
  125. programmer's Workbench colors is readable with mine.  I quickly got tired of
  126. that, and wrote SCT.  Now I have a command script with:
  127.  
  128. SCT >t:colors 1000 00bd
  129. Here I call the program.
  130. SCT >NIL: <t:colors
  131.  
  132. The first line saves the current colors in a temporary file and then
  133. changes the text color of the Workbench screen to a light blue.
  134. The second line starts up the program that used to look bad.  When it is done
  135. executing, the third line restores the saved colors from t:colors.
  136.  
  137. To display the Workbench color values:
  138.  
  139. SCT 2000
  140.  
  141. The 2000 is used to indicate that no colors are to be changed.
  142.  
  143. To copy the colors from one screen to another:
  144.  
  145. SCT >NiceColors -t "Nice Screen" 2000
  146. SCT >NIL: <NiceColors -t "Other Screen"
  147.  
  148. The first line saves the colors of the screen whose title is "Nice Screen"
  149. in the file NiceColors.  The second line "restores" the colors of the screen
  150. whose title is "Other Screen" using the contents of NiceColors.
  151.  
  152. To swap the colors of two screens:
  153.  
  154. SCT >ColorA -t "Screen A" 2000
  155. SCT >ColorB <ColorA -t "Screen B"
  156. SCT >NIL: <ColorB -t "Screen A"
  157.  
  158. (You can probably figure these out on your own by now, eh?)
  159. Keep in mind that if the two screens do not have the same number of colors,
  160. the one with more will end up with those extra colors unchanged.
  161.  
  162. To swap the colors of two screens regardless of the number of colors:
  163. (The ColorTable is repeated to make up the difference.)
  164.  
  165. SCT >ColorA -t "Screen A" 2000
  166. join ColorA ColorA ColorA ColorA as temp
  167. join temp temp temp temp as ColorA
  168. SCT >ColorB <ColorA -t "Screen B"
  169. join ColorB ColorB ColorB ColorB as temp
  170. join temp temp temp temp as ColorB
  171. SCT >NIL: <ColorB -t "Screen A"
  172.  
  173. The first line saves the colors of "Screen A" in the file `ColorA'.
  174. There may be as few as two colors in this screen, so it must be
  175. duplicated 16 times to be *certain* of containing at least 32 entries
  176. (Remember, extra entries are ignored).
  177. The second and third lines duplicate it four times each, giving 32 = 2*4*4.
  178. The fourth line colors "Screen B" with these values, while saving
  179. "Screen B"'s colors in `ColorB'.
  180. The fifth and sixth lines duplicate the number of entries by 16.
  181. The seventh line colors "Screen A" with these values.
  182.  
  183. A poor man's screen blanker:
  184.  
  185. SCT >t:SaveColors 0000 0000 0000 0000
  186. date ?
  187. SCT >NIL: <t:SaveColors
  188.  
  189. The first line saves the current colors and sets the screen to all black.
  190. The second line invokes the date command, and the question mark makes it wait
  191. for you to press return before executing.  Once that is done, the third line
  192. resets the saved colors.
  193.  
  194.